//
//  FISHLabel.m
//  FISH
//
//  Created by 鱼儿飞 on 2018/4/4.
//  Copyright © 2018年 www.yimindai.com. All rights reserved.
//

#import "FISHLabel.h"

@implementation FISHLabel
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.textColor = FISHLabelColor;
        self.textAlignment = NSTextAlignmentCenter;
        self.numberOfLines = 0;
        self.lineBreakMode = NSLineBreakByWordWrapping;
        self.font = FONTSIZE(16);
//        self.highlighted = YES;//Label是否高亮
    }
    return self;
}


- (void)drawRect:(CGRect)rect
{//自定义文字样式
    // Drawing code
    if (self.isDraw) {
        //获取当前图形环境的上下文
    //有时偶尔会使用到阴影设置
        self.shadowColor = KLightGrayColor;//设置阴影颜色
        self.shadowOffset = CGSizeMake(1, 1);//设置阴影的偏移
        CGContextRef context = UIGraphicsGetCurrentContext();

        //文字的渲染模式为描边模式
        CGContextSetTextDrawingMode(context, kCGTextStroke);
        //边框宽度2
        CGContextSetLineWidth(context, 2.0);
        //文字描边顶点连接方式为圆角
        CGContextSetLineJoin(context, kCGLineJoinRound);
        self.textColor = KWhiteColor;
        [super drawRect:rect];

        CGContextSetTextDrawingMode(context, kCGTextFill);
        self.textColor = KBlackColor;
        [super drawRect:rect];

//        CGContextSetRGBStrokeColor(context, 1, 0, 0, 1);
//
//        CGPoint points[2];
//        points[0] = CGPointMake(rect.origin.x, rect.size.height / 2);
//        points[1] = CGPointMake(rect.size.width, rect.size.height / 2);
//        CGContextAddLines(context, points, 2);
//
//        CGContextDrawPath(context, kCGPathStroke);
    }
    [super drawRect:rect];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
     Drawing code
}
*/

@end
